home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_9.lha / 7_9 / 7_9_next.c < prev    next >
Text File  |  1993-08-08  |  504b  |  31 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <stream.h>
  6. / Get the next entry from a list,
  7. / moving curr forward.
  8. nt dlist::next(dlink *&a)
  9.  
  10.    if (!last)
  11. return 0;
  12.  
  13.    // move curr forward, possibly to
  14.    // the beginning or end of the list.
  15.    if (curr)
  16. if (curr == last)
  17.     {
  18.     curr = 0;
  19.     return 0;
  20.     }
  21.  
  22. else
  23.     curr = curr->next;
  24.  
  25.    else
  26. curr = last->next;
  27.  
  28.    a = curr;
  29.    return 1;
  30.  
  31.